package com.itheima.safe.service.impl;

import com.aliyuncs.exceptions.ClientException;
import com.itheima.safe.service.AliyunSafeService;
import com.itheima.safe.util.AliyunSafeVerify;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Service;

import java.util.List;


@Data
@Service
@ConfigurationProperties(value = "aliyun")
public class AliyunSafeServiceImpl implements AliyunSafeService {

    private String appid;
    private String secret;

    /**
     * 批量文本安全风控检测
     * @param content
     * @return
     */
    @Override
    public boolean verifyContent(List<String> content) throws Exception {

        return AliyunSafeVerify.textVerify(appid,secret,content);
    }

    /**
     * 图片内容安全检测（多个）
     */
    @Override
    public boolean verifyImage(List<byte[]> images) throws ClientException {


        return AliyunSafeVerify.verifyImage(appid,secret,images);
    }
}
